﻿//osm服务
function TileOSMService(layerInfo) {
    var TileOSMService = new Object;
    TileOSMService.id = layerInfo.hasOwnProperty("GUID") ? layerInfo.GUID : "";
    TileOSMService.url = layerInfo.hasOwnProperty("URL") ? layerInfo.URL : "";
    TileOSMService.name = layerInfo.hasOwnProperty("NAME") ? layerInfo.NAME : "";
    TileOSMService.servertype = layerInfo.hasOwnProperty("SERVERTYPE") ? layerInfo.SERVERTYPE : "";
    TileOSMService.CreateLayer = function () {
        var id = this.id;
        var url = this.url;
        var name = this.name;
        var servertype = this.servertype;
        var source = new ol.source.OSM({
            url: url,
            wrapX: false
        });
        source.set("name", name, true);
        source.set("servertype", servertype, true);
        source.set("id", id, true);
        var thisLayer = new ol.layer.Tile({
            source: source
        });
        return thisLayer;
    }
    return TileOSMService;
}